package com.example.werthwedemo0309;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;

import com.example.werthwedemo0309.IntentData.BaseApplication;
import com.example.werthwedemo0309.IntentData.IWeatherPresenter;
import com.example.werthwedemo0309.IntentData.Wwather.WeatherRealtime;
import com.example.werthwedemo0309.IntentData.Wwather.WeatherResponse;
import com.example.werthwedemo0309.IntentData.Wwather.WeatherResult;

import java.io.IOException;
import java.util.List;

import retrofit2.Call;
import retrofit2.Response;


public class MainActivity extends AppCompatActivity {
    private static final String TAG = MainActivity.class.getSimpleName();
    private WeatherPresenter weatherLogic;
    public static Response<WeatherResponse<WeatherResult<WeatherRealtime>>> response;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        lorgin();
    }

    private void lorgin() {
        final Intent intent =  new Intent(this, OneActivity.class);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                startActivity(intent);
                finish();
            }
        }, 3000);
        try {
            initDD();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void initDD() throws IOException {
        new Thread(){
            @Override
            public void run() {
                Call<WeatherResponse<WeatherResult<WeatherRealtime>>> call = BaseApplication.httpbinService
                        .weatherList("西安", "b399f1b894aa3ee7154dbf1ed2b75ba7");
                try {
                    response = call.execute();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }.start();
    }

}
